import express from "express";
import { Request } from "express-jwt";
import { matchedData, query, validationResult } from "express-validator";


export const birdsRouter = express.Router({ mergeParams: true })

birdsRouter.get('/', query("person").notEmpty().escape(), (req: Request, res) => {
    const result = validationResult(req)
    if (result.isEmpty()) {
        const data = matchedData(req);
        res.send(`Hello, ${data.person}!`);
        return;
    }
    res.send({ errors: result.array() });
});


birdsRouter.get('/about', (req, res) => {
    res.send('About birds')
})




